<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/sm.css">
    <link rel="stylesheet" type="text/css" href="${staticpath}/front/dist/css/base.css">
    <title>打卡记录</title>
    <style>
        .save-btn{height: 100%;line-height: 45px;}
        p{margin: 0;}
        .record-hd{ padding:5px;}
        .record-hd  span:last-child{  float: right;}
        .record-item{margin-bottom: 10px; height: 50px;line-height: 50px;background: #fff;border-bottom: 1px solid #dadada;padding: 0 10px;}
        .record-item >img{border-radius: 50%;vertical-align: middle;width: 35px;height: 35px;margin-right: 10px;margin-left: 5px;}
        .record-item .item-time{margin-right: 5px;}
        .item-big-input{height: auto;line-height: 2em;}
        .record-item input{height: 40px;border: none;}
        textarea{width: 100%;border: 1px solid #dadada;line-height: 1em;height: 80px;resize: none;}
        select{width: 100%;height: 100%;border:0;}
    </style>
</head>
<body>
<div class="page-group">
    <div class="page" data-url="${basepath}/front/offline/toOfflineSignList" >
        <!--头部内容 !-->
        <header class="bar bar-nav">
            <a href="${basepath}/front/offline/toOfflineSignList" class="icon icon-left pull-left back" >返回</a>
            <h1 class="title">补卡申请 <span class="pull-right qrcode iconfont icon-erweima"></span></h1>
            <a href="javascript:;" class="pull-right save-btn">保存</a>
        </header>
        <div class="content">
            <div class="record-main">
                <div class="record-main my-sign-out-record">
                    <div class="record-item">
                        <input type="text" class="applicantName"  placeholder="请输入补卡人姓名"/>
                    </div>
                    <div class="record-item item-big-input">
                        <span>补卡事由:</span>
                        <p><textarea  class="description" placeholder="请输入补卡事由"></textarea></p>
                    </div>
                    <div class="record-item" style="text-align: center;;">
                        <select>
                            <option value="选择类型">选择类型</option>
                            <option value="in">补签到卡</option>
                            <option value="out">补签退卡</option>
                        </select>
                      
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>




<script type='text/javascript' src='${staticpath}/front/dist/js/lib/zepto.js' charset='utf-8'></script>
<script type='text/javascript' src='${staticpath}/front/dist/js/lib/sm.js' charset='utf-8'></script>
<script>
    function getQueryString(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return null;
    }
    //当前活动id,签到类型，姓名，事由
    var id = getQueryString("offlineId");
    var signType,applicantName,description;
    $('select').change(function(){
        signType=$(this).val();
    })
    $('.save-btn').click(function(){
        applicantName=$('.applicantName').val();
        description=$('.description').val();
        if(signType=='选择类型'){
            $.toast('请选择补卡类型');
            return false;
        }
        if(applicantName!=''&&description!=''&&signType!=undefined){
            $.ajax({
                url:'/front/offlineAccount/resign ',
                type:'POST',
                dataType:'json',
                data:{
                    offlineId:id,
                    applicantName:applicantName,
                    description:description,
                    signType:signType
                },
                success:function(res){
                    if(res.success){
                        $.toast(res.message);
                        setTimeout(function(){
                            window.history.go(-1);
                        },2000)
                    }else{
                        $.alert(res.message);
                    }
                }
            })

        }else{
            $.toast('请填写完整信息');
        }

    })




</script>
</body>
</html>